Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Do Not Merge] chore: Shadow PR to external contribution #36231 #36361

Closed
wants to merge 8 commits into from

Conversation

NilanshBansal
Copy link
Contributor

@NilanshBansal NilanshBansal commented Sep 17, 2024

Description

Shadow PR to run tests on external contribution #36231

Fixes #36073

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10899078369
Commit: 383128d
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Tue, 17 Sep 2024 08:31:09 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced logging capabilities across multiple plugins by replacing System.out.println with structured logging using log.debug and log.error.
  • Bug Fixes

    • Removed outdated logging method stopAndLogTimeInMillisWithSysOut from the Stopwatch class, improving logging consistency.
  • Chores

    • Updated dependencies in the project configuration to better support the new logging framework.

These changes improve maintainability, performance, and debugging capabilities across the application.

Copy link
Contributor

coderabbitai bot commented Sep 17, 2024

Walkthrough

The changes in this pull request focus on enhancing the logging practices across various plugins in the Appsmith application. The modifications involve replacing System.out.println statements with structured logging using log.debug and log.error. This transition aims to improve the maintainability and performance of the logging system, ensuring that logs are managed more effectively in production environments. Additionally, some methods have been updated to remove temporary logging workarounds, further streamlining the code.

Changes

File Path Change Summary
app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/Stopwatch.java Removed stopAndLogTimeInMillisWithSysOut method, retaining core functionality.
app/server/appsmith-plugins/** Replaced System.out.println with log.debug and log.error in various plugin classes for better logging practices.
app/server/appsmith-plugins/pom.xml Added new SLF4J dependencies and removed the exclusion of slf4j-reload4j.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin
    participant Logger

    User->>Plugin: Execute Method
    Plugin->>Logger: log.debug("Executing method...")
    Plugin->>Logger: log.error("An error occurred")
    Logger-->>Plugin: Log output
    Plugin-->>User: Return result
Loading

Assessment against linked issues

Objective Addressed Explanation
Logger does not work from the /appsmith-plugins directory (36073) The issue with logger visibility in the console remains unaddressed.

Possibly related PRs

Suggested labels

skip-changelog, ok-to-test

Poem

In the realm of code, where logs do flow,
A shift from prints to logs we bestow.
With log.debug shining bright,
Our plugins now log with delight!
Errors caught, no more dismay,
In structured logs, we'll find our way! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    -- I pushed a fix in commit <commit_id>, please review it.
    -- Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    -- @coderabbitai generate unit testing code for this file.
    -- @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    -- @coderabbitai generate interesting stats about this repository and render them as a table.
    -- @coderabbitai read src/utils.ts and generate unit testing code.
    -- @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    -- @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Backend This marks the issue or pull request to reference server code Bug Something isn't working Good First Issue Good for newcomers Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Inviting Contribution Issues that we would like contributions to Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage Production Query & JS Pod Issues related to the query & JS Pod Tech Debt Issues or Tasks which are tech debts labels Sep 17, 2024
@NilanshBansal NilanshBansal added the ok-to-test Required label for CI label Sep 17, 2024
@github-actions github-actions bot added Bug Something isn't working and removed Bug Something isn't working labels Sep 17, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java (1)

137-139: Using log.error for the connection pool issue is spot-on! 🎯

Logging an error message when there's a problem returning a connection to the pool is crucial for debugging. Great job using log.error for this!

One small suggestion though - let's remove the printStackTrace call in production code. Stack traces can clutter the logs and should usually be avoided in prod. You can keep it for local debugging.

To remove the stack trace, simply delete this line:

- e.printStackTrace();
Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d4807ac and 383128d.

Files selected for processing (27)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/Stopwatch.java (0 hunks)
  • app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java (19 hunks)
  • app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/utils/DatasourceUtils.java (3 hunks)
  • app/server/appsmith-plugins/anthropicPlugin/src/main/java/com/external/plugins/AnthropicPlugin.java (4 hunks)
  • app/server/appsmith-plugins/appsmithAiPlugin/src/main/java/com/external/plugins/AppsmithAiPlugin.java (5 hunks)
  • app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/plugins/ArangoDBPlugin.java (9 hunks)
  • app/server/appsmith-plugins/awsLambdaPlugin/src/main/java/com/external/plugins/AwsLambdaPlugin.java (5 hunks)
  • app/server/appsmith-plugins/databricksPlugin/src/main/java/com/external/plugins/DatabricksPlugin.java (7 hunks)
  • app/server/appsmith-plugins/dynamoPlugin/src/main/java/com/external/plugins/DynamoPlugin.java (7 hunks)
  • app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java (7 hunks)
  • app/server/appsmith-plugins/firestorePlugin/src/main/java/com/external/plugins/FirestorePlugin.java (10 hunks)
  • app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/GoogleAiPlugin.java (3 hunks)
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java (6 hunks)
  • app/server/appsmith-plugins/graphqlPlugin/src/main/java/com/external/plugins/GraphQLPlugin.java (2 hunks)
  • app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java (17 hunks)
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java (10 hunks)
  • app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java (17 hunks)
  • app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java (4 hunks)
  • app/server/appsmith-plugins/oraclePlugin/src/main/java/com/external/plugins/OraclePlugin.java (10 hunks)
  • app/server/appsmith-plugins/pom.xml (1 hunks)
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java (22 hunks)
  • app/server/appsmith-plugins/redisPlugin/src/main/java/com/external/plugins/RedisPlugin.java (6 hunks)
  • app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java (13 hunks)
  • app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java (3 hunks)
  • app/server/appsmith-plugins/saasPlugin/src/main/java/com/external/plugins/SaasPlugin.java (5 hunks)
  • app/server/appsmith-plugins/smtpPlugin/src/main/java/com/external/plugins/SmtpPlugin.java (8 hunks)
  • app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java (13 hunks)
Files not reviewed due to no reviewable changes (1)
  • app/server/appsmith-interfaces/src/main/java/com/appsmith/external/helpers/Stopwatch.java
Files skipped from review due to trivial changes (22)
  • app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/plugins/AmazonS3Plugin.java
  • app/server/appsmith-plugins/anthropicPlugin/src/main/java/com/external/plugins/AnthropicPlugin.java
  • app/server/appsmith-plugins/appsmithAiPlugin/src/main/java/com/external/plugins/AppsmithAiPlugin.java
  • app/server/appsmith-plugins/arangoDBPlugin/src/main/java/com/external/plugins/ArangoDBPlugin.java
  • app/server/appsmith-plugins/awsLambdaPlugin/src/main/java/com/external/plugins/AwsLambdaPlugin.java
  • app/server/appsmith-plugins/databricksPlugin/src/main/java/com/external/plugins/DatabricksPlugin.java
  • app/server/appsmith-plugins/dynamoPlugin/src/main/java/com/external/plugins/DynamoPlugin.java
  • app/server/appsmith-plugins/elasticSearchPlugin/src/main/java/com/external/plugins/ElasticSearchPlugin.java
  • app/server/appsmith-plugins/firestorePlugin/src/main/java/com/external/plugins/FirestorePlugin.java
  • app/server/appsmith-plugins/googleAiPlugin/src/main/java/com/external/plugins/GoogleAiPlugin.java
  • app/server/appsmith-plugins/googleSheetsPlugin/src/main/java/com/external/plugins/GoogleSheetsPlugin.java
  • app/server/appsmith-plugins/graphqlPlugin/src/main/java/com/external/plugins/GraphQLPlugin.java
  • app/server/appsmith-plugins/mongoPlugin/src/main/java/com/external/plugins/MongoPlugin.java
  • app/server/appsmith-plugins/mssqlPlugin/src/main/java/com/external/plugins/MssqlPlugin.java
  • app/server/appsmith-plugins/mysqlPlugin/src/main/java/com/external/plugins/MySqlPlugin.java
  • app/server/appsmith-plugins/openAiPlugin/src/main/java/com/external/plugins/OpenAiPlugin.java
  • app/server/appsmith-plugins/oraclePlugin/src/main/java/com/external/plugins/OraclePlugin.java
  • app/server/appsmith-plugins/postgresPlugin/src/main/java/com/external/plugins/PostgresPlugin.java
  • app/server/appsmith-plugins/redisPlugin/src/main/java/com/external/plugins/RedisPlugin.java
  • app/server/appsmith-plugins/redshiftPlugin/src/main/java/com/external/plugins/RedshiftPlugin.java
  • app/server/appsmith-plugins/restApiPlugin/src/main/java/com/external/plugins/RestApiPlugin.java
  • app/server/appsmith-plugins/smtpPlugin/src/main/java/com/external/plugins/SmtpPlugin.java
Additional comments not posted (10)
app/server/appsmith-plugins/pom.xml (2)

56-57: Excellent work, class! 👏

The dependency on org.pf4j:pf4j-spring with a provided scope is declared correctly. This will enable the use of the PF4J plugin framework in our application. Keep up the good work!


58-67: Great job on improving our logging infrastructure! 🌟

The addition of the slf4j-api and slf4j-simple dependencies with a provided scope is a step in the right direction. By leveraging SLF4J, we can achieve a more flexible and maintainable logging system. SLF4J provides a simple facade for various logging frameworks, allowing us to easily switch between different implementations without modifying our code.

Moreover, the removal of the slf4j-reload4j exclusion, as mentioned in the AI-generated summary, further streamlines our logging setup. This change will contribute to a cleaner and more efficient logging configuration.

Keep up the excellent work in enhancing our application's logging capabilities! 📝👨‍🏫

app/server/appsmith-plugins/amazons3Plugin/src/main/java/com/external/utils/DatasourceUtils.java (1)

15-15: Great job on improving the logging practices! The changes look good to me.

The introduction of the @Slf4j annotation and the replacement of System.out.println with a structured logging statement are excellent improvements. These changes will enhance the maintainability and traceability of the codebase.

A few additional suggestions to consider:

  1. Ensure that the log level is set appropriately based on the criticality of the information being logged. Debug-level logs are suitable for development and troubleshooting purposes, but you might want to use a higher level (e.g., INFO or WARN) for important events in production.

  2. Consider using parameterized logging instead of string concatenation. For example, instead of:

    log.debug(Thread.currentThread().getName() + ": getS3ClientBuilder action called.");

    You can use:

    log.debug("{}: getS3ClientBuilder action called.", Thread.currentThread().getName());

    This allows the logging framework to optimize the log message construction based on the configured log level.

Keep up the great work on improving the logging practices throughout the codebase!

Also applies to: 30-30, 106-106

app/server/appsmith-plugins/saasPlugin/src/main/java/com/external/plugins/SaasPlugin.java (2)

52-52: Great job utilizing the Lombok @Slf4j annotation! 👍

This annotation automatically generates a logger field for the class, making it convenient to perform structured logging using the SLF4J API. It's a cleaner approach compared to manually creating logger instances.


90-90: Excellent work enhancing the logging mechanism! 🌟

I noticed that you have replaced System.out.println statements with log.debug statements at key points in the execute method. This is a great practice for capturing the execution flow and processes using structured logging.

Additionally, you have switched from using stopAndLogTimeInMillisWithSysOut to stopAndLogTimeInMillis, which aligns with the goal of relying on structured logging instead of standard output.

These changes improve the maintainability and readability of the logging within the plugin's execution logic. Keep up the good work!

Also applies to: 139-143, 156-162

app/server/appsmith-plugins/snowflakePlugin/src/main/java/com/external/plugins/SnowflakePlugin.java (5)

74-74: Great job using a proper logging framework! 👍

Using log.debug instead of System.out.println is a best practice. The log message also provides helpful context about the thread and method being executed.


84-84: Excellent use of a logging framework! 🌟

log.debug is the way to go for logging. The message also helpfully indicates the thread and action. Keep up the good work!


Line range hint 109-116: Logging connection pool stats is a smart move! 🧠

Fantastic work using log.debug and including the query and pool stats in the log message. This will be super helpful for monitoring and troubleshooting. You're doing great!


Line range hint 128-132: Logging pool stats after the query is brilliant! 💡

Using log.debug and capturing the pool stats after query execution is an excellent practice. This will make monitoring and debugging much easier. Fantastic work, keep it up!


158-161: Logging at the start of key methods is a great debugging aid! 🔍

Wonderful work adding log.debug statements at the beginning of createConnectionClient and when creating the Snowflake connection client. Including the thread name and actions in the log messages is also very helpful for tracing and debugging.

Your logging practices are top-notch, keep up the excellent work!

@github-actions github-actions bot added the Bug Something isn't working label Sep 17, 2024
@github-actions github-actions bot removed the Bug Something isn't working label Sep 17, 2024
@NilanshBansal
Copy link
Contributor Author

Closing this as the original PR #36231 has been merged

@NilanshBansal NilanshBansal deleted the chore/issue-36073/shadow-36231 branch September 17, 2024 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend This marks the issue or pull request to reference server code Good First Issue Good for newcomers Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Inviting Contribution Issues that we would like contributions to Low An issue that is neither critical nor breaks a user flow Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production Query & JS Pod Issues related to the query & JS Pod Tech Debt Issues or Tasks which are tech debts
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Logger does not work from the /appsmith-plugins directory
2 participants